package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type user struct {
	Username string `form:"username" json:"username" binding:"required"`
	Password string `form:"password" json:"password" binding:"required"`
}

func main() {
	app := gin.Default()

	app.POST("/ping", func(context *gin.Context) {
		var user user
		err := context.ShouldBind(&user)
		if err != nil {
			context.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
			return
		}
		context.JSON(http.StatusOK, user)
	})

	app.Run()
}
